package com.czk.yygh.task.scheduled;

import com.czk.common.rabbit.constant.RabbitConstant;
import com.czk.common.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/12/1 22:06
 */
@Component
@EnableScheduling
public class ScheduledTask {
    @Autowired
    private RabbitService rabbitService;

    /**
     * 每隔30s去执行一次
     */
    @Scheduled(cron = "0/30 * * * * ?")
    public void taskPatient() {
        rabbitService.sendMessage(RabbitConstant.EXCHANGE_DIRECT_TASK, RabbitConstant.ROUTING_TASK_8, "提醒");
    }
}
